<template>
	<view class="framesSet">
		<comHead :title="$t('grzx.hmsz')" :isLeft="true" :isRight="false"></comHead>
		<view class="list">
			<view class="col">
				<text class="tit">{{$t('grzx.pmld')}}</text>
				<view class="slideBox">
					<slider backgroundColor="rgba(255, 255, 255, 0.3725)" active-color="rgb(94,107,252)" block-color="#fff"
						block-size="16" :value="brightness" min="0.02" max="1" step="0.02" @changing="sliderChanging" />
				</view>
			</view>

<!-- 			<text class="tit">{{$t('grzx.fbltj')}}</text>
			<view class="col">
				<view class="item">
					<radio-group name="" @change="radioChange">
						<label>
							<radio :value="'1'" /><text>{{$t('grzx.gq1080')}}</text>
							<image :src="changeImage(1)" mode=""></image>
						</label>
						<label>
							<radio :value="'2'" /><text>{{$t('grzx.lg4K')}}</text>
							<image :src="changeImage(2)" mode=""></image>
						</label>
					</radio-group>
				</view>
			</view> -->
		</view>
	</view>
</template>

<script>
// #ifdef H5
	import "../../static/uni.webview.js"
// #endif
	export default {
		data() {
			return {
				radioVal: '1',
				brightness: 0.6,
			}
		},
		methods: {
			sliderChanging(e) {
				// #ifndef H5
					uni.setScreenBrightness({
						value: e.detail.value,
						success: function() {
							console.log('value 发生变化：' + e.detail.value);
						}
					});
				// #endif
				
				// #ifdef H5
				uni.webView.postMessage({
					data:{
						type: 'set',
						val: e.detail.value
					}
				})
				// #endif
			},
			getBrightness() {
				// #ifndef H5
				uni.getScreenBrightness({
					success: (res) => {
						console.log(res.value);
						this.brightness = res.value;
					}
				});
				// #endif
				
				// #ifdef H5
				uni.webView.postMessage({
					data:{
						type: 'get'
					}
				})
				// #endif
			},
			radioChange(e) {
				this.radioVal = e.detail.value
			},
			changeImage(n) {
				if (n == this.radioVal) {
					return 'https://siha.vxmeng.com/static/my/selected.png';
				} else {
					return 'https://siha.vxmeng.com/static/my/no-selected.png';
				}
			},
		},
		onLoad() {
			this.getBrightness()
		}
	}
</script>

<style lang="less" scoped>
	.framesSet {
		height: 100vh;


		.tit {
			display: inline-flex;
			width: 100%;
			padding: 30rpx;
			box-sizing: border-box;
			font-size: 32rpx;
			color: rgba(255, 255, 255, 0.5451);
		}

		.slideBox {
			/deep/uni-slider .uni-slider-handle-wrapper {
				height: 14rpx;
			}

			/deep/uni-slider .uni-slider-track {
				background: linear-gradient(270deg, #5F58FD 0%, #62B6FC 100%);
			}
		}

		.list {
			padding: 30rpx;
			box-sizing: border-box;

			.col {
				background-color: rgba(40, 46, 81, .6);
				padding: 20rpx 0;
				margin-bottom: 20rpx;
				border-radius: 20rpx;

				.item {
					padding: 0 30rpx;
					box-sizing: border-box;
					display: flex;
					justify-content: space-between;
					align-items: center;

					radio-group {
						display: flex;
						flex-direction: column;
						width: 100%;

						/deep/uni-radio .uni-radio-input {
							width: 40rpx;
							height: 40rpx;
							background: none !important;
						}

						label {
							padding: 30rpx 0;
							position: relative;
							border-bottom: 1rpx solid rgba(#FFFFFF, 0.1);

							text {
								color: #fff;
								// font-size: 24rpx;
								margin-left: 20rpx;
							}

							image {
								position: absolute;
								width: 32rpx;
								height: 32rpx;
								left: 20rpx;
								top: 38rpx;
							}

							radio {
								visibility: hidden;
							}
						}

						label:last-child {
							border: none;
						}
					}
				}
			}
		}
	}
</style>